home *** CD-ROM | disk | FTP | other *** search
- (*************************************************************************
-
- $RCSfile: HookUtil.mod $
- Description:
-
- Created by: fjc (Frank Copeland)
- $Revision: 3.8 $
- $Author: fjc $
- $Date: 1995/06/29 19:06:56 $
-
- Copyright © 1994, Frank Copeland.
- This file is part of the Oberon-A Library.
- See Oberon-A.doc for conditions of use and distribution.
-
- *************************************************************************)
-
- <* STANDARD- *>
-
- MODULE HookUtil;
-
- IMPORT SYS := SYSTEM, e := Exec, u := Utility;
-
- (*------------------------------------*)
- (*
- This procedure is intended to be installed in the entry field of a
- u.Hook record. Its purpose is to push the parameters passed to it
- onto the stack and call the procedure installed in the subEntry field.
-
- The parameters are:
-
- hook : u.HookPtr; (* passed in the A0 register *)
- object : e.APTR; (* passed in the A2 register *)
- message : e.APTR; (* passed in the A1 register *)
-
- Stack checking should be turned off (<*$StackChk-*>) in all procedures
- installed in Hooks, as they are likely to be running in a non-Oberon
- context.
- *)
-
- PROCEDURE HookEntry* () : e.APTR;
-
- <*$EntryExitCode-*>
- BEGIN (* HookEntry *)
- SYS.INLINE (
- 2F08H, (* MOVE.L A0, -(A7) *)
- 2F0AH, (* MOVE.L A2, -(A7) *)
- 2F09H, (* MOVE.L A1, -(A7) *)
- 2068H, 000CH, (* MOVE.L 000C(A0), A0 *)
- 4E90H, (* JSR (A0) *)
- 4E75H ) (* RTS *)
- (*
- No RETURN is required, result is already in D0.
- The procedure in subEntry will clean up the parameters on the stack.
- *)
- END HookEntry;
-
- (*------------------------------------*)
- PROCEDURE InitHook *
- (VAR hook : u.Hook; subEntry : u.HookFunc; data : e.APTR);
-
- BEGIN (* InitHook *)
- hook.entry := HookEntry;
- hook.subEntry := subEntry;
- hook.data := data;
- END InitHook;
-
- END HookUtil.
-